<template>
	<!-- 米券余额 -->
	<view class="shell_wp">
		<view class="shell_nav">
			<view class="shell_nav_number">{{info.bk}}</view>
			<view>米券</view>
		</view>
		<view class="shell_detailed">明细</view>
		<view class="shell_list">
			<view class="shell_item" v-for="(item,index) in list" :key="index">
				<view class="shell_info">
					<text>{{item.title}}</text>
					<text>{{item.createtime}}</text>
				</view>
				<view class="shell_number">{{item.num}}</view>
			</view>
		</view>
		<view class="loading_message">
			<image v-if="isloading" src="../../static/business/loading.gif"></image>
			<view v-if="isempty">到底了~</view>
		</view>
	</view>
</template>

<script>
	export default{
		data() {
			return {
				info:{bk:'00'},
				
				page:0,
				list:[],
				isempty:false,
				isloading:false,
				stopload:false,
				
				
			}
		},
		onReachBottom() {
			this.getlist();
		},
		onLoad() {
			this.getinfo();
			this.getlist();
		},
		methods:{
			getinfo(){
				this.$axios('log/bkmain ','POST','member').then(res=>{
					if(res.data.code==200){
						this.info=res.data.data;
					}
				})
			},
			getlist(){
				if(this.stopload) return;
				this.stopload=true;
				this.page+=1;
				this.isloading=true;
				this.$axios('log/bklist','POST','member',{page:this.page}).then(res=>{
					this.isloading=false;
					if(res.data.code==200){
						let length=res.data.data.list.length;
						this.list=this.list.concat(res.data.data.list);
						this.isempty=length<10?true:false;
						this.stopload=length<10?true:false;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #f2f2f2;
	color: $font-color-dark;
}
.shell_wp{
	padding-bottom: 100upx;
}
.shell_nav{
	background-color: $base-color;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	height: 260upx;
}
.shell_nav_number{
	font-size: 40upx;
	line-height: 60upx;
}
.shell_detailed{
	font-size: 30upx;
	padding: 20upx;
}
.shell_item{
	background-color: #fff;
	border-radius: 10upx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20upx;
	height: 140upx;
	margin: 0 20upx 20upx;
}
.shell_info{
	display: flex;
	flex-direction: column;
}
.shell_info text{
	line-height: 50upx;
}
.shell_info text:nth-of-type(2){
	color: $font-color-light;
}
.shell_number{
	font-weight: bold;
}
.loading_message image{
	display: block;
	margin: 0 auto;
	height: 60upx;
	width: 60upx;
}
.loading_message view{
	text-align: center;
	color: $font-color-spec;
}
</style>
